package cn.org.donald.controller;

import cn.org.donald.base.BaseController;
import cn.org.donald.base.HttpResult;
import cn.org.donald.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author : Donald
 * @since : 2021/3/16 16:48
 */
@RestController
@RequestMapping("/auth")
@Api(value = "认证前端控制器")
public class AuthController extends BaseController {

    @Resource
    private UserService userService;

    @PostMapping("/login")
    @ApiOperation(value = "用户登录")
    public HttpResult login(@RequestBody Map<String,String> map) {
        String authorization = userService.login(map);
        return toSuccess("登录成功!",authorization);
    }
}
